import { defineStore } from 'pinia';

export const usePublicStore = defineStore('public', {
  state: () => {
    return {
      chat_cur_model: {} as any,
      activeIndex: '4',
      createSceneObj: {
        name: '',
        type: '',
        userId: '',
        layers: [] as any,
        toolLab: [] as any,
      },
      createSceneCurrentStep: 0,
      RenderOptions: {} as any,
      // 两种参数分开存储，防止tab控件切换dom的渲染问题污染同一个参数选项（tab切换要么所有tab选项都在第一次全部渲染，要么加上key选项则在每次切换tab后所有tab选项都会重新渲染）
      LabelOptions: {} as any,
    };
  },
  actions: {
    updateActiveIndex(currentIndex: string) {
      this.$state.activeIndex = currentIndex;
    },
    setCreateSceneCurrentStep(step: number) {
      this.$state.createSceneCurrentStep = step;
    },
    setRenderOptions(options: any) {
      this.$state.RenderOptions = options;
    },
    setLabelOptions(options: any) {
      this.$state.LabelOptions = options;
    },
    updateChatModel(model: any) {
      this.$state.chat_cur_model = model;
    },
  },
});
